using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Spawn : MonoBehaviour
{
    private Transform player;

    public GameObject item;
    // Start is called before the first frame update
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").transform;
    }
    

    //丢弃物品到世界地图上
    public void SpawnDropedItem()
    {
        float offset = player.localScale.x;
        Instantiate(item, new Vector2(player.position.x+offset*2, player.position.y), Quaternion.identity);
    }

    //点击物体加血
    public void AddHealth()
    {
        if (HealthBar.curHealth<HealthBar.totalHealth)
        {
            HealthBar.curHealth += 1;
            Destroy(gameObject);
        }
    }

}
